package com.my.jli.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @ClassName ExceptionController
 * @Description
 * @Author MaYu
 * @Date 2022/4/2 20:38
 * @Version 1.0
 **/
@ControllerAdvice
public class ExceptionController {
    private final Logger logger = LoggerFactory.getLogger(ExceptionController.class);
    @ExceptionHandler
    public String exceptionHandler(Exception e){
        logger.error("全局异常", e);
        return "redirect:/error";
    }
}
